<?php
// wcf imports
require_once(WCF_DIR.'lib/data/user/User.class.php');
require_once(WCF_DIR.'lib/data/user/option/UserOptionOutput.class.php');

/*
 * Implements an WCom Profilefield
 * @svn			$Id: UserOptionOutputWComName.class.php 652 2010-01-10 14:27:40Z TobiasH87 $
 * @author	Sani9000 , WCF 1.0 UserOptionOutput and WCom adjustment by TobiasH
 * @license	Lesser General Public License <http://www.gnu.org/licenses/lgpl.html>
 * @package	com.woltlab.community.profile.wcom
*/
 
class UserOptionOutputWComName implements UserOptionOutput {
	protected $type = 'wcomname';
	
	/*
	 * @see UserOptionOutput::getShortOutput()
	*/
	public function getShortOutput(User $user, $optionData, $value) {
		if (empty($value)) return '';
		$this->getImage($user, 'S') . ' ' . $value;
	}

	/*
	 * @see UserOptionOutput::getMediumOutput()
	*/
  
	public function getMediumOutput(User $user, $optionData, $value) {
		if (empty($value)) return '';
		$this->getImage($user, 'S') . ' ' . $value;
	}
	
	/*
	 * @see UserOptionOutput::getOutput()
	*/
   
	public function getOutput(User $user, $optionData, $value) {
		if (empty($value)) return '';
		return $this->getImage($user, 'M') . ' ' . StringUtil::encodeHTML($value);
	}
	
	/*
	 * Returns the icon html code.
	 * 
	 * @return	string 
	*/
   
	protected function getImage(User $user, $imageSize = 'M') {
		$title = WCF::getLanguage()->get('wcf.user.profile.'.$this->type.'.title', array('$username' => StringUtil::encodeHTML($user->username)));
		return '<img src="'.RELATIVE_WCF_DIR.'icon/'.$this->type.$imageSize.'.png" alt="" title="'.$title.'" />';
	}
}
?>